<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class HomePage extends CI_Controller{
	public function HomePage(){
		parent::__construct();
        $this->load->library('smarty_ci');
        $this->load->helper(array('form','url'));
	}
    function var_global(){
        $site['base_url']=BASE_URL;
        $site['open_form']=form_open('','name="search_form" id="search_form" method="get"');
        $site['close_form']=form_close();
        return $site;
    }
	public function index(){
        if(empty($_GET['key']) || !isset($_GET['key'])){
            $site=$this->var_global();
            $site['title']='Dữ liệu điện tử trường đại học kinh tế quốc dân';
		    $this->smarty_ci->view('public/homepage.tpl',$site);
            exit();
        }else{
            $this->search();
        }
        if(isset($_POST['submit'])){
            
        }
	}

    function search(){
        $site=$this->var_global();
        $site['key_request']=$this->input->get('key',TRUE);
        $site['title']=$site['key_request'].' | dev.neu.search | ngankt2@gmail.com';
        $site['search_box']=$this->input->get('box',true);
        $site['num_res']=0;
        $site['time_res']=0;
        $site['open_form_comment']=form_open('','name="search_form" id="search_form"');
        $this->smarty_ci->view('public/search.tpl',$site);
    }
    function comment(){
        
    }
}